Passed
Branch master (b8a2ae)
by Samson
02:23
created

T_CONST ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 1
rs 10
c 0
b 0
f 0
1
const GeezConverter = require('./Converter/GeezConverter');
0 ignored issues
show
Unused Code introduced by
The constant GeezConverter seems to be never used. Consider removing it.
Loading history...
2
const AsciiConverter = require('./Converter/AsciiConverter');
0 ignored issues
show
Unused Code introduced by
The constant AsciiConverter seems to be never used. Consider removing it.
Loading history...
3
4
/**
5
 * Geezify converts numbers in ASCII to Geez and vise versa.
6
 *
7
 * @author Sam As End <4sam21{at}gmail.com>
8
 */
9
module.exports = class Geezify {
10
    /**
11
     * Geezify constructor.
12
     *
13
     * @param $geez_converter
14
     * @param $ascii_converter
15
     */
16
    constructor($geez_converter, $ascii_converter) {
17
        this.geez_converter = $geez_converter;
18
        this.ascii_converter = $ascii_converter;
19
    }
20
21
    /**
22
     * Return a new Geezify instance.
23
     *
24
     * @return Geezify
25
     */
26
    static create() {
27
        return new Geezify(new GeezConverter(), new AsciiConverter());
0 ignored issues
show
Bug introduced by
The variable GeezConverter seems to be never declared. If this is a global, consider adding a /** global: GeezConverter */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable AsciiConverter seems to be never declared. If this is a global, consider adding a /** global: AsciiConverter */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
28
    }
29
30
    /**
31
     * Converts ASCII number to geez.
32
     *
33
     * @param $ascii_number
34
     *
35
     * @throws \Geezify\Exception\NotAnIntegerArgumentException
36
     *
37
     * @return string
38
     */
39
    toGeez($ascii_number) {
40
        return this.geez_converter.convert($ascii_number);
41
    }
42
43
    /**
44
     * Convert geez to ASCII.
45
     *
46
     * @param string $geez_number
47
     *
48
     * @throws \Geezify\Exception\NotGeezArgumentException
49
     *
50
     * @return int
51
     */
52
    toAscii($geez_number) {
53
        return this.ascii_converter.convert($geez_number);
54
    }
55
56
    /**
57
     * @return GeezConverter
58
     */
59
    getGeezConverter() {
60
        return this.geez_converter;
61
    }
62
63
    /**
64
     * @param GeezConverter $geez_converter
65
     */
66
    setGeezConverter($geez_converter) {
67
        this.geez_converter = $geez_converter;
68
    }
69
70
    /**
71
     * @return AsciiConverter
72
     */
73
    getAsciiConverter() {
74
        return this.ascii_converter;
75
    }
76
77
    /**
78
     * @param AsciiConverter $ascii_converter
79
     */
80
    setAsciiConverter($ascii_converter) {
81
        this.ascii_converter = $ascii_converter;
82
    }
83
};
84